<?php
namespace app\admin\controller;

use app\common\controller\AdminBase;
use app\admin\model\Admin as AdminModel;
use app\admin\model\Contact as Ct;
use think\Request;
use think\Loader;
use think\Url;

class Contact extends AdminBase
{
	public function index()
	{
		return 'test';
	}

	public function lists()
	{
		//获取 contact 列表

		$pageIndex = $this->request->param('pageIndex');
		$pageSize = $this->request->param('pageSize');

		$count = Ct::count('id');
		$archive = Ct::limit(($pageIndex-1)*$pageSize,$pageSize)->order('id desc')->select();

		// 获取用户的所有博客

		$json = [];
		$json = [
			'rel'	=>	true,
			'msg'	=>	'获取成功',
			'list'	=>	$archive,
			'count'	=>	$count,
		];
		return json($json)
			->code(201)
			->header([
				'Cache-control' => 'no-cache,must-revalidate',
				'Access-Control-Allow-Origin' =>	'*',
				]);
	}

}